<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
            function actSelect(obj, pageName) {
                var pkid = obj;
                var sfeature = "dialogwidth:1100px;dialogheight:600px;center:yes;location:no;help:no;resizable:no;scroll:yes;status:no";
                var arg = new Object();
                arg.doType = "select";
                if (pageName == "Sub_Detail") {
                    var rtn = dialog("../item/itemQry_Cstpl_Sub.xhtml?strType=2&amp;strSubCttPkid=" + pkid + "", arg, sfeature);
                } else if (pageName == "Attachment") {
                    var rtn = window.open("/epss/servlet/ShowServlet?operType=Qry&amp;strType=0&amp;strPkid=" + pkid + "",
                            'popupwindow',
                            'height = 300,width = 450,location = no,resizable = no,scrollbars = no,status = no,toolbar = no,top = 100');
                }
            }
        </script>
    </ui:define>
    <ui:define name="content">
        <h:form id="form">
            <p:growl id="msgs" showDetail="true"/>
            <p:focus for="id"/>
            <p:panel>
                <h:panelGrid id="pdQry" columns="3" style="width: 100%">
                    <h:panelGrid>
                        <h:panelGrid columns="4">
                            <p:outputLabel value="合同编号：" for="id"/>
                            <p:inputText id="id" value="#{subCttInfoAction.cttInfoShowQry.id}"/>
                            <p:outputLabel value="合同名称：" for="cttName"/>
                            <p:inputText id="cttName" value="#{subCttInfoAction.cttInfoShowQry.name}"
                                         style="width: 328px"/>
                            <p:outputLabel value="签订日期：" for="signDate"/>
                            <p:inputText id="signDate" value="#{subCttInfoAction.cttInfoShowQry.signDate}"
                                         onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                            <p:outputLabel value="备注内容：" for="note"/>
                            <p:inputText id="note" value="#{subCttInfoAction.cttInfoShowQry.note}"/>
                            <p:outputLabel value="签订甲方：" for="signPartA"/>
                            <p:selectOneMenu id="signPartA" value="#{subCttInfoAction.cttInfoShowQry.signPartA}"
                                             disabled="#{subCttInfoAction.styleModel.disabled_Flag}">
                                <f:selectItems value="#{esCommon.customerlist}"/>
                            </p:selectOneMenu>
                            <p:outputLabel value="签订乙方：" for="signPartB"/>
                            <p:selectOneMenu id="signPartB" value="#{subCttInfoAction.cttInfoShowQry.signPartB}"
                                             disabled="#{subCttInfoAction.styleModel.disabled_Flag}">
                                <f:selectItems value="#{esCommon.customerlist}"/>
                            </p:selectOneMenu>
                        </h:panelGrid>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <h:panelGrid>
                            <p:commandButton id="qryBtn" value="查询"
                                             action="#{subCttInfoAction.onQueryAction('Qry','true')}"
                                             update="pdt,pdQry,msgs">
                            </p:commandButton>
                            <p:commandButton id="resetBtn" value="重置"
                                             type="reset"
                                             update="pdQry,msgs">
                            </p:commandButton>
                        </h:panelGrid>
                        <p:ajaxStatus style="width:16px;height:16px;">
                            <f:facet name="start">
                                <h:graphicImage value="/images/ajaxloading.gif"/>
                            </f:facet>
                            <f:facet name="complete">
                                <h:outputText value=""/>
                            </f:facet>
                        </p:ajaxStatus>
                    </h:panelGrid>
                </h:panelGrid>
            </p:panel>
            <p:contextMenu for="pdt">
                <p:menuitem value="浏览" icon="ui-icon-search"
                            actionListener="#{subCttInfoAction.selectRecordAction('Qry','')}"
                            update="pgView,pdt,msgs"
                            onclick="PF('wVDlgView').show()">
                </p:menuitem>
                <p:menuitem value="详细内容" icon="ui-icon-search"
                            oncomplete="actSelect(DtInitSubcttList.selection,'Sub_Detail')">
                </p:menuitem>
                <p:menuitem value="附件" icon="ui-icon-search"
                            oncomplete="actSelect(DtInitSubcttList.selection,'Attachment')">
                </p:menuitem>
            </p:contextMenu>
            <p:dataTable id="pdt" style="width:100%;"
                         value="#{subCttInfoAction.cttInfoShowList}"
                         var="record"
                         rowKey="#{record.pkid}"
                         selection="#{subCttInfoAction.cttInfoShowSelected}"
                         selectionMode="single"
                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                         {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         paginator="true"
                         paginatorPosition="bottom"
                         rows="15"
                         rowIndexVar="row"
                         rowsPerPageTemplate="500,200,100,45,30,15"
                         emptyMessage="数据记录为空..."
                         widgetVar="DtInitSubcttList"
                         scrollable="true">
                <p:column headerText="序号" style="width:30px">
                    <h:outputText value="#{row + 1}"/>
                </p:column>
                <p:column headerText="分包合同号" style="width:120px;text-align:center">
                    <h:outputText value="#{record.id}"/>
                </p:column>
                <p:column headerText="分包合同名" style="width:200px;text-align:left">
                    <h:outputText value="#{record.name}"/>
                </p:column>
                <p:column headerText="签订甲方" style="width:200px;text-align:left">
                    <h:outputText value="#{esCommon.getCustNameByCustIdFromList(record.signPartA)}"/>
                </p:column>
                <p:column headerText="签订乙方" style="width:200px;text-align:left">
                    <h:outputText value="#{esCommon.getCustNameByCustIdFromList(record.signPartB)}"/>
                </p:column>
                <p:column headerText="状态标志" style="width:66px;text-align:center">
                    <h:outputText value="#{esFlowControl.getLabelByValueInStatusFlaglist(record.statusFlag)}"/>
                </p:column>
                <p:column headerText="原因" style="width:66px;text-align:center">
                    <h:outputText value="#{esFlowControl.getLabelByValueInPreStatusFlaglist(record.preStatusFlag)}"/>
                </p:column>
                <p:column headerText="开始时间" style="width:66px;text-align:center">
                    <h:outputText value="#{record.cttStartDate}"/>
                </p:column>
                <p:column headerText="截止时间" style="width:66px;text-align:center">
                    <h:outputText value="#{record.cttEndDate}"/>
                </p:column>
                <p:column headerText="签订日期" style="width:66px;text-align:center">
                    <h:outputText value="#{record.signDate}"/>
                </p:column>
            </p:dataTable>
            <p:dialog id="dlgView" header="分包合同维护" widgetVar="wVDlgView"
                      resizable="false" modal="true"
                      showEffect="clip" hideEffect="fold">
                <h:panelGrid id="pgView">
                    <h:panelGrid columns="2">
                        <p:outputLabel value="合同编号：" for="idForDlg"/>
                        <p:inputText id="idForDlg" value="#{subCttInfoAction.cttInfoShowSel.id}"
                                     readonly="true"
                                     style="background-color:gainsboro;"/>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <p:outputLabel value="合同名称：" for="cttNameForDlg"/>
                        <p:inputText id="cttNameForDlg" value="#{subCttInfoAction.cttInfoShowSel.name}"
                                     readonly="true"
                                     style="background-color:gainsboro;width:328px;"/>
                    </h:panelGrid>
                    <h:panelGrid columns="4">
                        <p:outputLabel value="备注内容：" for="noteForDlg"/>
                        <p:inputText id="noteForDlg" value="#{subCttInfoAction.cttInfoShowSel.note}"
                                     readonly="true"
                                     style="background-color:gainsboro;"/>
                        <p:outputLabel value="签订日期：" for="signDateForDlg"/>
                        <p:inputText id="signDateForDlg" value="#{subCttInfoAction.cttInfoShowSel.signDate}"
                                     readonly="true"
                                     style="background-color:gainsboro;"/>
                        <p:outputLabel value="开始时间：" for="cttStartDateForDlg"/>
                        <p:inputText id="cttStartDateForDlg" value="#{subCttInfoAction.cttInfoShowSel.cttStartDate}"
                                     readonly="true"
                                     style="background-color:gainsboro;"/>
                        <p:outputLabel value="截止时间：" for="cttEndDateForDlg"/>
                        <p:inputText id="cttEndDateForDlg" value="#{subCttInfoAction.cttInfoShowSel.cttEndDate}"
                                     readonly="true"
                                     style="background-color:gainsboro;"/>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <p:outputLabel value="签订甲方：" for="signPartAForDlg"/>
                        <p:inputText id="signPartAForDlg" value="#{subCttInfoAction.cttInfoShowSel.signPartAName}"
                                     readonly="true"
                                     style="background-color:gainsboro;width:328px;">
                        </p:inputText>
                        <p:outputLabel value="签订乙方：" for="signPartBForDlg"/>
                        <p:inputText id="signPartBForDlg" value="#{subCttInfoAction.cttInfoShowSel.signPartBName}"
                                     readonly="true"
                                     style="background-color:gainsboro;width:328px;">
                        </p:inputText>
                    </h:panelGrid>
                    <h:panelGrid columns="4">
                        <p:outputLabel for="createdByNameSel" value="创建人：" />
                        <h:inputText id="createdByNameSel"
                                     value="#{subCttInfoAction.cttInfoShowSel.createdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="createdDateSel" value="创建时间：" />
                        <h:inputText id="createdDateSel"
                                     value="#{subCttInfoAction.cttInfoShowSel.createdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdByNameSel" value="修改人：" />
                        <h:inputText id="lastUpdByNameSel"
                                     value="#{subCttInfoAction.cttInfoShowSel.lastUpdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdDateSel" value="修改时间：" />
                        <h:inputText id="lastUpdDateSel"
                                     value="#{subCttInfoAction.cttInfoShowSel.lastUpdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="modificationNumSel" value="修改次数：" />
                        <h:inputText id="modificationNumSel"
                                     value="#{subCttInfoAction.cttInfoShowSel.modificationNum}"
                                     style="background-color:gainsboro;text-align:right;" readonly="true">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0"/>
                        </h:inputText>
                    </h:panelGrid>
                </h:panelGrid>
            </p:dialog>
        </h:form>
    </ui:define>
</ui:composition>